-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add instrumentation to allow sending kafka payload size on produce #6228
Conversation
internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/AgentPropagation.java
Outdated
Show resolved
Hide resolved
d7b4f5c
to
5ac65d1
Compare
.../src/main/java/datadog/trace/instrumentation/kafka_clients/KafkaProducerInstrumentation.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If payload size stats are really required on producer side, separating the stat calculation from the injection is a required step at this point.
It looks ok but please ask an explicit review to apm-java and dsm folks (because of the API change).
Kafka / producer-benchmarkParameters
See matching parameters
SummaryFound 1 performance improvements and 0 performance regressions! Performance is the same for 2 metrics, 0 unstable metrics.
See unchanged results
|
Kafka / consumer-benchmarkParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 3 metrics, 0 unstable metrics. See unchanged results
|
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 45 metrics, 9 unstable metrics. Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.27.0-SNAPSHOT~60e046dffa, baseline=1.27.0-SNAPSHOT~97e88a8887
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.049 s) : 0, 1049427
Total [baseline] (9.345 s) : 0, 9345146
Agent [candidate] (1.053 s) : 0, 1052581
Total [candidate] (9.361 s) : 0, 9360576
section appsec
Agent [baseline] (1.151 s) : 0, 1151401
Total [baseline] (9.469 s) : 0, 9469468
Agent [candidate] (1.156 s) : 0, 1156049
Total [candidate] (9.451 s) : 0, 9450905
section iast
Agent [baseline] (1.168 s) : 0, 1167697
Total [baseline] (9.602 s) : 0, 9602329
Agent [candidate] (1.169 s) : 0, 1168993
Total [candidate] (9.586 s) : 0, 9585757
section profiling
Agent [baseline] (1.255 s) : 0, 1254667
Total [baseline] (9.746 s) : 0, 9746403
Agent [candidate] (1.245 s) : 0, 1245304
Total [candidate] (9.615 s) : 0, 9614942
gantt
title petclinic - break down per module: candidate=1.27.0-SNAPSHOT~60e046dffa, baseline=1.27.0-SNAPSHOT~97e88a8887
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (649.822 ms) : 0, 649822
BytebuddyAgent [candidate] (651.442 ms) : 0, 651442
GlobalTracer [baseline] (306.884 ms) : 0, 306884
GlobalTracer [candidate] (308.494 ms) : 0, 308494
AppSec [baseline] (50.557 ms) : 0, 50557
AppSec [candidate] (50.482 ms) : 0, 50482
Remote Config [baseline] (672.99 µs) : 0, 673
Remote Config [candidate] (672.336 µs) : 0, 672
Telemetry [baseline] (7.298 ms) : 0, 7298
Telemetry [candidate] (7.208 ms) : 0, 7208
section appsec
BytebuddyAgent [baseline] (653.323 ms) : 0, 653323
BytebuddyAgent [candidate] (655.211 ms) : 0, 655211
GlobalTracer [baseline] (307.605 ms) : 0, 307605
GlobalTracer [candidate] (309.143 ms) : 0, 309143
AppSec [baseline] (148.57 ms) : 0, 148570
AppSec [candidate] (149.513 ms) : 0, 149513
Remote Config [baseline] (647.962 µs) : 0, 648
Remote Config [candidate] (651.346 µs) : 0, 651
Telemetry [baseline] (6.931 ms) : 0, 6931
Telemetry [candidate] (6.989 ms) : 0, 6989
section iast
BytebuddyAgent [baseline] (769.024 ms) : 0, 769024
BytebuddyAgent [candidate] (770.189 ms) : 0, 770189
GlobalTracer [baseline] (285.069 ms) : 0, 285069
GlobalTracer [candidate] (284.704 ms) : 0, 284704
AppSec [baseline] (50.786 ms) : 0, 50786
AppSec [candidate] (52.581 ms) : 0, 52581
Remote Config [baseline] (570.671 µs) : 0, 571
Remote Config [candidate] (593.929 µs) : 0, 594
Telemetry [baseline] (8.71 ms) : 0, 8710
Telemetry [candidate] (7.202 ms) : 0, 7202
IAST [baseline] (19.221 ms) : 0, 19221
IAST [candidate] (19.425 ms) : 0, 19425
section profiling
BytebuddyAgent [baseline] (664.903 ms) : 0, 664903
BytebuddyAgent [candidate] (659.495 ms) : 0, 659495
GlobalTracer [baseline] (379.568 ms) : 0, 379568
GlobalTracer [candidate] (377.594 ms) : 0, 377594
AppSec [baseline] (51.602 ms) : 0, 51602
AppSec [candidate] (50.982 ms) : 0, 50982
Remote Config [baseline] (997.608 µs) : 0, 998
Remote Config [candidate] (988.027 µs) : 0, 988
Telemetry [baseline] (7.311 ms) : 0, 7311
Telemetry [candidate] (7.174 ms) : 0, 7174
ProfilingAgent [baseline] (95.544 ms) : 0, 95544
ProfilingAgent [candidate] (94.744 ms) : 0, 94744
Profiling [baseline] (95.569 ms) : 0, 95569
Profiling [candidate] (94.769 ms) : 0, 94769
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.27.0-SNAPSHOT~60e046dffa, baseline=1.27.0-SNAPSHOT~97e88a8887
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.054 s) : 0, 1054318
Total [baseline] (8.736 s) : 0, 8735587
Agent [candidate] (1.057 s) : 0, 1057042
Total [candidate] (8.774 s) : 0, 8773618
section iast
Agent [baseline] (1.166 s) : 0, 1165751
Total [baseline] (9.262 s) : 0, 9262052
Agent [candidate] (1.187 s) : 0, 1187137
Total [candidate] (9.282 s) : 0, 9281926
section iast_TELEMETRY_OFF
Agent [baseline] (1.178 s) : 0, 1177904
Total [baseline] (9.33 s) : 0, 9330035
Agent [candidate] (1.163 s) : 0, 1163320
Total [candidate] (9.27 s) : 0, 9269848
gantt
title insecure-bank - break down per module: candidate=1.27.0-SNAPSHOT~60e046dffa, baseline=1.27.0-SNAPSHOT~97e88a8887
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (652.761 ms) : 0, 652761
BytebuddyAgent [candidate] (654.479 ms) : 0, 654479
GlobalTracer [baseline] (308.409 ms) : 0, 308409
GlobalTracer [candidate] (309.109 ms) : 0, 309109
AppSec [baseline] (50.81 ms) : 0, 50810
AppSec [candidate] (50.999 ms) : 0, 50999
Remote Config [baseline] (680.044 µs) : 0, 680
Remote Config [candidate] (677.199 µs) : 0, 677
Telemetry [baseline] (7.282 ms) : 0, 7282
Telemetry [candidate] (7.253 ms) : 0, 7253
section iast
BytebuddyAgent [baseline] (768.007 ms) : 0, 768007
BytebuddyAgent [candidate] (782.963 ms) : 0, 782963
GlobalTracer [baseline] (284.789 ms) : 0, 284789
GlobalTracer [candidate] (289.655 ms) : 0, 289655
AppSec [baseline] (52.833 ms) : 0, 52833
AppSec [candidate] (53.504 ms) : 0, 53504
Remote Config [baseline] (560.93 µs) : 0, 561
Remote Config [candidate] (567.641 µs) : 0, 568
Telemetry [baseline] (6.412 ms) : 0, 6412
Telemetry [candidate] (6.475 ms) : 0, 6475
IAST [baseline] (18.957 ms) : 0, 18957
IAST [candidate] (19.217 ms) : 0, 19217
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (773.174 ms) : 0, 773174
BytebuddyAgent [candidate] (762.961 ms) : 0, 762961
GlobalTracer [baseline] (289.045 ms) : 0, 289045
GlobalTracer [candidate] (285.879 ms) : 0, 285879
AppSec [baseline] (50.047 ms) : 0, 50047
AppSec [candidate] (49.341 ms) : 0, 49341
Remote Config [baseline] (599.726 µs) : 0, 600
Remote Config [candidate] (623.637 µs) : 0, 624
Telemetry [baseline] (6.532 ms) : 0, 6532
Telemetry [candidate] (7.425 ms) : 0, 7425
IAST [baseline] (23.826 ms) : 0, 23826
IAST [candidate] (22.691 ms) : 0, 22691
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 10 metrics, 12 unstable metrics. Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.27.0-SNAPSHOT~60e046dffa, baseline=1.27.0-SNAPSHOT~97e88a8887
dateFormat X
axisFormat %s
section baseline
no_agent (1.359 ms) : 1340, 1378
. : milestone, 1359,
appsec (1.781 ms) : 1755, 1806
. : milestone, 1781,
iast (1.523 ms) : 1499, 1548
. : milestone, 1523,
profiling (1.52 ms) : 1494, 1545
. : milestone, 1520,
tracing (1.495 ms) : 1470, 1520
. : milestone, 1495,
section candidate
no_agent (1.369 ms) : 1349, 1390
. : milestone, 1369,
appsec (1.782 ms) : 1756, 1807
. : milestone, 1782,
iast (1.513 ms) : 1488, 1537
. : milestone, 1513,
profiling (1.548 ms) : 1523, 1573
. : milestone, 1548,
tracing (1.494 ms) : 1469, 1519
. : milestone, 1494,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.27.0-SNAPSHOT~60e046dffa, baseline=1.27.0-SNAPSHOT~97e88a8887
dateFormat X
axisFormat %s
section baseline
no_agent (368.796 µs) : 349, 389
. : milestone, 369,
iast (485.964 µs) : 465, 507
. : milestone, 486,
iast_FULL (547.66 µs) : 527, 568
. : milestone, 548,
iast_INACTIVE (454.316 µs) : 434, 475
. : milestone, 454,
iast_TELEMETRY_OFF (471.194 µs) : 451, 492
. : milestone, 471,
tracing (445.616 µs) : 425, 466
. : milestone, 446,
section candidate
no_agent (369.143 µs) : 349, 390
. : milestone, 369,
iast (488.687 µs) : 468, 510
. : milestone, 489,
iast_FULL (542.815 µs) : 522, 563
. : milestone, 543,
iast_INACTIVE (450.163 µs) : 429, 471
. : milestone, 450,
iast_TELEMETRY_OFF (480.496 µs) : 460, 501
. : milestone, 480,
tracing (441.279 µs) : 421, 462
. : milestone, 441,
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Only one minor question.
I worked on this topic on #6045 but upon closer review, realized that I forgot to tool the produce side, which should send the payload size as well, according to the spec
To minimize the performance impact of computing the payload size, I'm reusing the result of such a computation that already happens in the kafka client as part of the
send
code, here, by instrumenting this method.To do that, the solution I found was to hijack the code where the metric is sent, to save it until we know the payload size, and send it only then.
I see 3 ways to save the stats before we send them:
baggageItem
in the span, but that's unnecessary string manipulations